<?php
/**
 * Database interface for use with the WLP library
 *
 * This files contains the interface for database interaction with WLP's
 * library of classes.
 *
 * @author David Stangeby <david.stangeby@gmail.com>
 * @version 0.1
 * @package WLP
 * @copyright  Copyright (c) 2005-2009 Arctic Solutions (http://www.arcticsolutions.no/)
 * @license    http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt GNU General Public License v2
 */

/**
 * Interface for database interaction for WLP.
 *
 * @package WLP
 */
interface WLP_Db_Interface
{
    /**
     * Constructor
     *
     * Sets options for the class, usually connetion information to the database.
     *
     * @param array $options Array of options to be set for the class
     * @return void
     */
    public function __construct($options = null);
    
    /**
     * Set database object options from an array.
     *
     * @param array $options
     * @return WLP_Db_Interface
     */
    public function setOptions($options);
    
    /**
     * Inserts a single item to the database.
     *
     * @param string $table Table to save the item to
     * @param array $item Array with the rows of data
     * @return bool Returns true or false depending if the insert was successful
     */
    public function insertItem($table, $item);
    
    /**
     * Inserts multiple items to a database.
     * 
     * @param string $table Table to save the items to
     * @param array $items Zero indexed array containing items and their rows of data
     * @return bool Returns true or false depending if the inserts was successful
     */
    public function insertItems($table, $items);
    
    /**
     * Gets a single item from the database.
     *
     * @param string $table Table to get item from
     * @param array $columns Array of columns to get
     * @param string $where Optional where statement
     * @return array Result of the query
     */
    public function getItem($table, $columns, $where = '');
    
    /**
     * Gets multiple items from a database.
     *
     * @param string $table Table to get items from
     * @param array $columns Array of columns to get
     * @param string $where Optional where statement
     * @return array Result of the query
     */
    public function getItems($table, $columns, $where = '');
    
    /**
     * Quotes variables for use in SQL strings.
     *
     * @param string $string String to be quoted
     * @return string Quoted string
     */
    public function quote($string);
}